package com.cheer.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Optional;

@AllArgsConstructor
@Getter
public enum SexTypeEnum {

    MAN(1, "男"),
    WOMAN(2, "女");

    private Integer code;
    private String desc;

    public static SexTypeEnum getByTypeCode(Integer typeCode){

        SexTypeEnum[] values = SexTypeEnum.values();
        Optional<SexTypeEnum> first = Arrays.stream(values).filter(resourceEnum -> typeCode.equals(resourceEnum.getCode())).findFirst();

        return first.orElse(null);
    }



}
